<template>
<div class="app-container calendar-list-container">
    <el-form :label-position="'left'" label-width="100px" class="demo-ruleForm">
      <el-row>
        <el-col :span="11">
          <div class="filter-container">
            <router-link :to="path">
              <span class="back-link"><svg-icon icon-class="ds-left-double-arrow" /> 返回</span>
            </router-link>
          </div>
        </el-col>
      </el-row>
      <el-row class="left-block">
        <el-col :span="18">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>基础信息</span>
            </div>
              <el-form-item label="名称">
                <span>{{info.name}}</span>
              </el-form-item>
              <el-form-item label="公众号">
                <span>{{info.public_account}}</span>
              </el-form-item>
              <el-form-item label="公众号ID">
                <span>{{info.public_account_id}}</span>
              </el-form-item>
              <el-form-item label="联系方式">
                <span>{{info.phone}}</span>
              </el-form-item>
              <el-form-item label="登录账号">
                <span>{{info.account}}</span>
              </el-form-item>
          </el-card>
        </el-col>
      </el-row>
      <el-row class="right-block">
        <el-col :span="18" :offset="1">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>课程</span>
            </div>
            <el-form-item label="合作课程" prop="type">
              <el-checkbox-group>
                <div class="classify" v-for="(item,index) in info.essay_array_test" :key="index">
                  <span>{{item.class_1_name}}</span>
                  <span v-for="(detail,list) in item['children']" :key="list">
                    <span>{{detail.class_2_name}}</span>
                  </span>
                </div>
              </el-checkbox-group>
            </el-form-item>
          </el-card>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<style scoped>
  .el-form-item__content {
    color: #666;
  }
  .el-col-18 {
    width: 90%;
  }
  .el-col-18  >>> .el-card__body {
    height: 412px;
  }
  .text {
    font-size: 14px;
  }
  .item {
    margin-bottom: 28px;
  }
  .button {
    float: right;
    margin: 50px 100px;
  }
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .left-block, .right-block {
    width: 50%;
    float: left;
  }
  .classify {
    margin-bottom: 28px;
  }
  .classify > span {
    color: #f56c6c;
    font-size: 15px;
    margin: 0 15px;
    display: inline-block;
  }
  .el-form-item {
    margin-bottom: 22px;
    border-bottom: 1px solid #ebeef5;
    padding-bottom: 10px;
  }
</style>
<script>
  import { detail } from '@/api/partner'
  export default {
    data() {
      return {
        path: '/partner/index',
        info: {},
        infoClassify: [],
        infoEssay: []
      }
    },
    created() {
      this.detail()
    },
    methods: {
      detail() {
        detail(this.$route.params.id).then(response => {
          this.info = response.data
          this.$set(this.infoClassify, 0, this.info.essay_array_test)
          console.log(this.infoClassify)
          for (let i = 0; i < this.infoClassify.length; i++) {
            this.$set(this.infoEssay, i, this.infoClassify[i][i].children)
          }
        })
      }
    }
  }
</script>
